package com.warom.sdg.dto;

import com.google.gson.annotations.SerializedName;

/**
 * 分页请求数据传输对象
 * 用于前端向后端传递分页相关参数
 */
public class PageRequestDto {
    /**
     * 当前页码，从1开始
     */
    @SerializedName("page")
    private Integer page = 1;

    /**
     * 每页记录数
     */
    @SerializedName("pageSize")
    private Integer pageSize = 10;

    /**
     * 关键字搜索
     */
    @SerializedName("keyword")
    private String keyword;

    /**
     * 排序字段
     */
    @SerializedName("sortField")
    private String sortField;

    /**
     * 排序方向（asc/desc）
     */
    @SerializedName("sortDirection")
    private String sortDirection;

    /**
     * 开始日期筛选（ISO 8601格式）
     */
    @SerializedName("startDate")
    private String startDate;

    /**
     * 结束日期筛选（ISO 8601格式）
     */
    @SerializedName("endDate")
    private String endDate;

    /**
     * 操作类型筛选
     */
    @SerializedName("operationType")
    private String operationType;

    /**
     * 操作状态筛选
     */
    @SerializedName("operationStatus")
    private String operationStatus;

    // 构造函数
    public PageRequestDto() {
    }

    public PageRequestDto(Integer page, Integer pageSize) {
        this.page = page;
        this.pageSize = pageSize;
    }

    // Getters and Setters
    public Integer getPage() {
        return page != null && page > 0 ? page : 1;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getPageSize() {
        return pageSize != null && pageSize > 0 ? pageSize : 10;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public String getSortField() {
        return sortField;
    }

    public void setSortField(String sortField) {
        this.sortField = sortField;
    }

    public String getSortDirection() {
        return sortDirection;
    }

    public void setSortDirection(String sortDirection) {
        this.sortDirection = sortDirection;
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getOperationType() {
        return operationType;
    }

    public void setOperationType(String operationType) {
        this.operationType = operationType;
    }

    public String getOperationStatus() {
        return operationStatus;
    }

    public void setOperationStatus(String operationStatus) {
        this.operationStatus = operationStatus;
    }

    @Override
    public String toString() {
        return "PageRequestDto{" +
                "page=" + page +
                ", pageSize=" + pageSize +
                ", keyword='" + keyword + '\'' +
                ", sortField='" + sortField + '\'' +
                ", sortDirection='" + sortDirection + '\'' +
                ", startDate='" + startDate + '\'' +
                ", endDate='" + endDate + '\'' +
                ", operationType='" + operationType + '\'' +
                ", operationStatus='" + operationStatus + '\'' +
                '}';
    }
} 